var area_id;
var zonename="";
var isIE = (document.all && window.ActiveXObject && !window.opera) ? true : false;
var isChrome = navigator.userAgent.indexOf('Chrome') != -1;
var DMURL = document.location.protocol+'//'+location.hostname+(location.port ? ':'+location.port : '')+'/';
var AJPath = (DTPath.indexOf('://') == -1 ? DTPath : (DTPath.indexOf(DMURL) == -1 ? DMURL : DTPath))+'api.php';
/*if(isIE) try {document.execCommand("BackgroundImageCache", false, true);} catch(e) {}*/
var xmlHttp
function makeRequest_area(queryString, php, func, method) {
	xmlHttp = Try.these(
		function() {return new XMLHttpRequest()},
		function() {return new ActiveXObject('Msxml2.XMLHTTP')},
		function() {return new ActiveXObject('Microsoft.XMLHTTP')}
	);
	method = (typeof method == 'undefined') ? 'post' : 'get';
	if(func) xmlHttp.onreadystatechange = eval(func);
	xmlHttp.open(method, method == 'post' ? php : php+'?'+queryString, true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(method == 'post' ? queryString : null);
}

function load_area(areaid,idname ,id) {
	area_id = id;
    area_areaid[id]= areaid;
    var tempname = $("#"+idname).find("option:selected").text();
    var sss = idname.split('_');
    if(sss[1]=='0'){
        zonename = tempname;
    }else{
    	zonename += tempname;
    }
	makeRequest_area('op=area&act=ajax_area&area_title='+area_title[id]+'&area_deep='+area_deep[id]+'&area_extend='+area_extend[id]+'&area_id='+area_id+'&areaid='+areaid, AJPath, 'into_area');
}
function into_area()
{
	if(xmlHttp.readyState==4 && xmlHttp.status==200)
    {
		$('#zonename_'+area_id)[0].value = zonename;
        $('#areaid_'+area_id)[0].value = area_areaid[area_id];
		if(xmlHttp.responseText)
        {
            $('#load_area_'+area_id)[0].innerHTML = xmlHttp.responseText;
        }
	}
}
